/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.manager.editar;

import br.com.deployment.entidade.selo.CorSelo;
import br.com.deployment.message.Msg;
import br.com.deployment.servico.CorSeloServico;
import java.io.IOException;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author luciano
 */
@ManagedBean
@SessionScoped
public class ManagerEditarCorSelo implements Serializable{

    @EJB
    CorSeloServico corSeloServico;
    
    CorSelo corSelo;
    
    public ManagerEditarCorSelo() {}
    
    public void atualizar(){
        corSeloServico.atualizar(corSelo);
        Msg.messagemInfo("Cor do selo salvo com sucesso.");
    }
    
     public void redirect(String string, CorSelo corSelo) {
        try {
            FacesContext context = FacesContext.getCurrentInstance();
            this.corSelo = corSelo;
            context.getExternalContext().redirect(string);
        } catch (IOException ex) {
            Logger.getLogger(ManagerEditarOperacao.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public CorSelo getCorSelo() {
        return corSelo;
    }

    public void setCorSelo(CorSelo corSelo) {
        this.corSelo = corSelo;
    }
    
     
    
}
